import request from '@/utils/request'
import downloadService from '@/utils/downloadService'
// 获取医生信息
export function getDoctorInfo () {
  return request({
    url: '/getDoctorInfo',
    method: 'get'
  })
}

export function getCommentDetail (id, queryCommentParams) {
  return request({
    url: '/getCommentDetail',
    method: 'get',
    params: {
      id: id,
      pageNum: queryCommentParams.pageNum,
      pageSize: queryCommentParams.pageSize
    }
  })
}

export function getDateAppointmentInfo (id, date) {
  return request({
    url: '/getDateAppointmentInfo',
    method: 'get',
    params: {
      id: id,
      date: date
    }
  })
}

export function getDoctorLeaveInfo (id) {
  return request({
    url: '/getDoctorLeaveInfo',
    method: 'get',
    params: {
      id: id
    }
  })
}

export function getAppointmentLog (type, queryHaveParams) {
  return request({
    url: '/getAppointmentLog',
    method: 'get',
    params: {
      type: type,
      pageNum: queryHaveParams.pageNum,
      pageSize: queryHaveParams.pageSize
    }
  })
}
export function cancelAppointmentLog (id) {
  return request({
    url: '/cancelAppointmentLog',
    method: 'get',
    params: {
      id: id
    }
  })
}
export function getCommentById (id) {
  return request({
    url: '/getCommentById',
    method: 'get',
    params: {
      id: id
    }
  })
}
export function onSubmit (from) {
  return request({
    url: '/submitAppointmentInfo',
    method: 'post',
    data: {
      appointmentDate: from.appointmentDate,
      slot: from.slot,
      desc: from.desc,
      doctorId: from.id
    }
  })
}

export function updateAppointmentInfo (from) {
  return request({
    url: '/updateAppointmentInfo',
    method: 'post',
    data: {
      appointmentDate: from.appointmentDate,
      slot: from.slot,
      desc: from.desc,
      doctorId: from.doctorId,
      id: from.id
    }
  })
}

export function submitComment (from) {
  return request({
    url: '/submitComment',
    method: 'post',
    data: {
      consultationId: from.id,
      content: from.desc,
      servicePoint: from.servicePoint
    }
  })
}

export function getVisitRecode (id) {
  return request({
    url: '/getVisitRecode',
    method: 'get',
    params: {
      id: id
    }
  })
}
export function download (fileSavePath) {
  return request({
    url: '/download',
    method: 'get',
    responseType: 'blob',
    params: {
      fileSavePath: fileSavePath
    }
  })
}

export function downloadPdf (id) {
  return downloadService({
    url: '/downloadPdf',
    method: 'get',
    responseType: 'blob',
    params: {
      id: id
    }
  })
}
